package tt.dz.egobus.servicemanager.vo;

import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotEmpty;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.BeansException;
import tt.dz.egobus.api.usercenter.staff.StaffBack;

import java.io.Serializable;

/**
 * @author Anson
 * @date 17-4-17
 * @name
 * @since 1.0.4
 */
public class DriverViewVo implements Serializable {

    private static final Logger LOGGER = LoggerFactory.getLogger(DriverViewVo.class);
    private static final long serialVersionUID = -2843606528657347018L;

    public StaffBack convert() {
        StaffBack pojo = new StaffBack();
        try {
            BeanUtils.copyProperties(this, pojo);
        } catch (BeansException e) {
            LOGGER.error("StaffBackViewVo -> StaffBack bean拷贝异常, viewVo={}", this, e);
        }
        return pojo;
    }

    public DriverViewVo view(StaffBack pojo) {
        try {
            BeanUtils.copyProperties(pojo, this);
        } catch (BeansException e) {
            LOGGER.error(" StaffBack ->  StaffBackViewVo bean拷贝异常, viewVo={}", this, e);
        }
        return this;
    }


    /**
     * 司机的id
     **/
    private String id;

    /**
     * 司机的身份证号码
     **/
    @Length(max = 18, message = "司机的身份证号码长度不能超过18")
    @NotEmpty(message = "司机的身份证号码长度不能为空")
    private String idCard;

    /**
     * 司机的真实姓名
     **/
    @Length(max = 32, message = "司机的真实姓名长度不能超过32")
    @NotEmpty(message = "司机的真实姓名长度不能为空")
    private String realName;

    /**
     * 是否激活
     */
    private Boolean isVal = false;


    /**
     * 司机的性别
     **/
    private String genderMsg;

    /**
     * 司机的性别 （0：男 1：女）
     **/
    private int gender;

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public String getRealName() {
        return realName;
    }

    public void setRealName(String realName) {
        this.realName = realName;
    }

    public Boolean getIsVal() {
        return isVal;
    }

    public void setIsVal(Boolean val) {
        isVal = val;
    }

    public String getGenderMsg() {
        return genderMsg;
    }

    public void setGenderMsg(String genderMsg) {
        this.genderMsg = genderMsg;
    }

    public int getGender() {
        return gender;
    }

    public void setGender(int gender) {
        this.gender = gender;
    }

    @Override
    public String toString() {
        return "DriverViewVo{" +
                "id='" + id + '\'' +
                ", idCard='" + idCard + '\'' +
                ", realName='" + realName + '\'' +
                ", isVal=" + isVal +
                ", genderMsg='" + genderMsg + '\'' +
                ", gender=" + gender +
                '}';
    }
}
